package com.ivi.car.module.carstate.model;

import android.arch.lifecycle.Lifecycle;

import com.ivi.car.base.BaseModel;
import com.ivi.car.bean.carstate.CarPartState;
import com.trello.rxlifecycle2.LifecycleProvider;

import java.util.ArrayList;

/**
 * Copyright
 * author chengxp
 * date 2018/3/6
 * describe
 * history
 */

public class StateModel extends BaseModel {

    public StateModel(LifecycleProvider<Lifecycle.Event> provider) {
        super(provider);
    }

    /**
     * 获取各个零部件的状态集合
     *
     * @return ArrayList 集合
     */
    public ArrayList<CarPartState> getPartsState() {
        ArrayList mList = new ArrayList();
        mList.add(getOilState());
        mList.add(getOilFilterState());
        mList.add(getFuelFilterState());
        mList.add(getFuelAdditive());
        mList.add(getAirFilter());
        mList.add(getAirPurifier());
        return mList;
    }

    /**
     * 获取机油机滤状态
     *
     * @return PartState
     */
    public CarPartState getOilState() {
        int time = (int) (0 + Math.random() * 20);
        int mileage = (int) (0 + Math.random() * 100);
        return new CarPartState("机油机滤", 10, 50, time, mileage);
    }

    /**
     * 获取机油滤清器状态
     *
     * @return PartState
     */
    public CarPartState getOilFilterState() {
        int time = (int) (0 + Math.random() * 20);
        int mileage = (int) (0 + Math.random() * 100);
        return new CarPartState("机油滤清器", 10, 50, time, mileage);
    }

    /**
     * 获取燃油滤清器状态
     *
     * @return PartState
     */
    public CarPartState getFuelFilterState() {
        int time = (int) (0 + Math.random() * 20);
        int mileage = (int) (0 + Math.random() * 100);
        return new CarPartState("燃油滤清器", 10, 50, time, mileage);
    }

    /**
     * 获取燃油添加剂状态
     *
     * @return PartState
     */
    public CarPartState getFuelAdditive() {
        int time = (int) (0 + Math.random() * 20);
        int mileage = (int) (0 + Math.random() * 100);
        return new CarPartState("燃油添加剂", 10, 50, time, mileage);
    }

    /**
     * 获取空气滤清器状态
     *
     * @return PartState
     */
    public CarPartState getAirFilter() {
        int time = (int) (0 + Math.random() * 20);
        int mileage = (int) (0 + Math.random() * 100);
        return new CarPartState("空气滤清器", 10, 50, time, mileage);
    }

    /**
     * 获取空气净化器状态
     *
     * @return PartState
     */
    public CarPartState getAirPurifier() {
        int time = (int) (0 + Math.random() * 20);
        int mileage = (int) (0 + Math.random() * 100);
        return new CarPartState("空气净化器", 10, 50, time, mileage);
    }


}
